#!/bin/bash
#clean and create directory

compress_single()
{
  single=$1
  ftype=$2
  files=$3

  echo > $single.tmp
  for file in $files
  do
         cat $file >> $single.tmp
  done

  java -jar $YUIC --charset utf-8 --type $ftype $single.tmp -o $single
  rm $single.tmp 
}

SCRIPT=$(readlink -f $0)
CWD=$(dirname $(dirname $SCRIPT))
YUIC=../../install/yuicompressor.jar
export YUIC

jsfiles="
   lib/codemirror.js
   addon/edit/matchbrackets.js
   mode/xml/xml.js
   mode/javascript/javascript.js
   mode/css/css.js
   mode/php/php.js
   mode/sql/sql.js
   mode/htmlmixed/htmlmixed.js
   addon/search/searchcursor.js
   addon/selection/active-line.js
   
"
compress_file=$(compress_single 'codemirror.min.js' 'js' "$jsfiles")
mv -f codemirror.min.js ./lib/

cssfiles="
   lib/codemirror.css
" 

compress_file=$(compress_single $dir 'codemirror.min.css' 'css' "$cssfiles")
mv -f codemirror.min.css ./lib/

